<?php include dirname(__FILE__).'/common/header.php'; ?>

<?php include dirname(__FILE__).'/common/menu.php'; ?>

var attr = {};
attr.ctrlName = '<?php echo $ctrlName; ?>';
attr.game_gift = <?php echo $game_gift ?>;
attr.type_arr = [[1,'预热篇'],[2,'双12篇'],[3,'圣诞篇']];
attr.gift_status = [['0','未核销'],['1','已核销']];

/*
| -------------------------------------------------------------------
|  List Grid
| -------------------------------------------------------------------
*/
list.grid = new ZM.GridPanel({
    url: list.baseUrl + attr.ctrlName+'/getLotteryHistoryList',
    tbar:[{
        text:'导出过滤数据',
        cls:'btn-show',
        hidden:!Ext.permission[attr.ctrlName + '/exportList'.toLowerCase()],
        handler:function() {
            var sortInfo = list.grid.store.getSortState();
            if(sortInfo) {
                list.grid.store.baseParams['sort'] = sortInfo['field'];
                list.grid.store.baseParams['dir'] = sortInfo['direction'];
            }
            location.href = list.baseUrl + attr.ctrlName + '/exportList?'+ Ext.urlEncode(list.grid.store.baseParams);
        }
    }],
    columns:[
        {header:'顾客ID',dataIndex:'customer_id',filter:{},width:80},
        {header:'openid',dataIndex:'openid',width:150,filter:{}},
        {header:'活动类别',dataIndex:'type',renderer:function(val) {
            return ZM.id2name(val,attr.type_arr);
        },filter:{
            xtype:'combofield',
            options:[['','全部']].concat(attr.type_arr)
        }},
        {header:'卡券号',dataIndex:'code',filter:{}},
        {header:'奖品',dataIndex:'gift_type',renderer:function(val) {
            var str = ZM.id2name(val,attr.game_gift);
            return str ? str : '未中奖';
        },filter:{
            xtype:'combofield',
            options:[['','全部'],['0','无'],['-1','已中奖']].concat(attr.game_gift)
        }},
        {header:'奖品状态',dataIndex:'gift_status',filter:{xtype:'combofield',options:[['','全部']].concat(attr.gift_status)},renderer:function(val,m,r) {
            return ZM.id2name(val,attr.gift_status);
        }},
        {header:'抽奖时间',dataIndex:'lottery_time_time_create',width:140,filter:{xtype:'daterangefield'}},
        {header:'领取时间',dataIndex:'lottery_time_time_active',width:140,filter:{xtype:'daterangefield'}},
        {header:'抽奖来源',dataIndex:'lottery_source',filter:{}}
    ]
});
/*
| -------------------------------------------------------------------
|  List Grid Action
| -------------------------------------------------------------------
*/


<?php include dirname(__FILE__).'/common/layout.php'; ?>
list.grid.store.load();
<?php include dirname(__FILE__).'/common/footer.php'; ?>
